package com.psw.monitor.geserialport.model;

import java.math.BigDecimal;

public class SerialPortMessage {
    byte[] header = new byte[2];  // 固定AA BB
    byte[] peerAddr = new byte[6];  // 对端地址（网桥，接收端）
    byte[] addr = new byte[6];// 设备地址（发射端地址）
    int rssi;         // 信号强度
    long ticks;         // 时间戳10ms单位
    ScanResponseData scanresponsedata;
    byte[] footer = new byte[2];  // 固定CC DD


    public ScanResponseData getScanresponsedata() {
        return scanresponsedata;
    }

    public void setScanresponsedata(ScanResponseData scanresponsedata) {
        this.scanresponsedata = scanresponsedata;
    }
    //这个结构体S/C 共享，不要随意调整。如果需要增加请使用预留容量且保证总体size不变。
    public static class ScanResponseData {
        byte[] header = new byte[2];
        char[] str = new char["GE_CCM".length() + 1];
        TempHumidData[] tempHumidData = new TempHumidData[2];
        SGP30Data sgp30Data;
        BMP280Data bmp280Data;
        byte[] ioData = new byte[4];
        short[] adcData = new short[3];
        byte[] reserved = new byte[4];
        byte[] randomValue = new byte[16];

        public byte[] getHeader() {
            return header;
        }

        public void setHeader(byte[] header) {
            this.header = header;
        }

        public char[] getStr() {
            return str;
        }

        public void setStr(char[] str) {
            this.str = str;
        }

        public TempHumidData[] getTempHumidData() {
            return tempHumidData;
        }

        public void setTempHumidData(TempHumidData[] tempHumidData) {
            this.tempHumidData = tempHumidData;
        }

        public SGP30Data getSgp30Data() {
            return sgp30Data;
        }

        public void setSgp30Data(SGP30Data sgp30Data) {
            this.sgp30Data = sgp30Data;
        }

        public BMP280Data getBmp280Data() {
            return bmp280Data;
        }

        public void setBmp280Data(BMP280Data bmp280Data) {
            this.bmp280Data = bmp280Data;
        }

        public byte[] getIoData() {
            return ioData;
        }

        public void setIoData(byte[] ioData) {
            this.ioData = ioData;
        }

        public short[] getAdcData() {
            return adcData;
        }

        public void setAdcData(short[] adcData) {
            this.adcData = adcData;
        }

        public byte[] getReserved() {
            return reserved;
        }

        public void setReserved(byte[] reserved) {
            this.reserved = reserved;
        }

        public byte[] getRandomValue() {
            return randomValue;
        }

        public void setRandomValue(byte[] randomValue) {
            this.randomValue = randomValue;
        }
    }

    public static class TempHumidData {
        BigDecimal temperature;    // 温度数据
        BigDecimal humidity;// 湿度数据

        public BigDecimal getTemperature() {
            return temperature;
        }

        public void setTemperature(BigDecimal temperature) {
            this.temperature = temperature;
        }

        public BigDecimal getHumidity() {
            return humidity;
        }

        public void setHumidity(BigDecimal humidity) {
            this.humidity = humidity;
        }
    }

    public static class SGP30Data {
        short eco2; // eCO2值
        short tvoc; // TVOC值

        public short getEco2() {
            return eco2;
        }

        public void setEco2(short eco2) {
            this.eco2 = eco2;
        }

        public short getTvoc() {
            return tvoc;
        }

        public void setTvoc(short tvoc) {
            this.tvoc = tvoc;
        }
    }

    public static class BMP280Data {
        float pressure; // 气压数据, 单位: hPa
        byte temperature; // 温度数据, 单位: °C

        public float getPressure() {
            return pressure;
        }

        public void setPressure(float pressure) {
            this.pressure = pressure;
        }

        public byte getTemperature() {
            return temperature;
        }

        public void setTemperature(byte temperature) {
            this.temperature = temperature;
        }
    }

    public byte[] getHeader() {
        return header;
    }

    public void setHeader(byte[] header) {
        this.header = header;
    }

    public byte[] getPeerAddr() {
        return peerAddr;
    }

    public void setPeerAddr(byte[] peerAddr) {
        this.peerAddr = peerAddr;
    }

    public byte[] getAddr() {
        return addr;
    }

    public void setAddr(byte[] addr) {
        this.addr = addr;
    }

    public int getRssi() {
        return rssi;
    }

    public void setRssi(int rssi) {
        this.rssi = rssi;
    }

    public long getTicks() {
        return ticks;
    }

    public void setTicks(long ticks) {
        this.ticks = ticks;
    }

    public byte[] getFooter() {
        return footer;
    }

    public void setFooter(byte[] footer) {
        this.footer = footer;
    }
}


